<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01globalcomponent</title>
    <script type="text/javascript" src="../js/vue.js"></script>
    <style>
        .templateStyle{
            border: 1px solid green;
            box-shadow: 10px 10px 5px grey;
            margin-top: 50px;
        }
    </style>
</head>
<body>
    <template id="t1">
        <div class="templateStyle">
            <h1>你好中国</h1>
            <div>{{msg}}</div>
            <div>{{title}}</div>
        </div>
    </template>
    <div id="app1">
        <hello></hello>
    </div>
    <div id="app2">
        <hello></hello>
    </div>
</body>
</html>
<script>
    Vue.component('hello',{
        template:'#t1',
        data:function(){
            return{
                msg:'陕西',
                title:'西安'
            }
        }
    });
    var vm1=new Vue({
        el:'#app1'
    });
    var vm2=new Vue({
        el:'#app2'
    });
</script>